Extensions described in this article allow you to block the execution and wait until certain condition, based on OPC UA item data, is fulfilled.
With methods in this group, you can subscribe to specified OPC UA nodes and attributes, and wait by monitoring their data until specified conditions (predicates) become true, and then automatically unsubscribe. The methods also return when the specified time elapses. The item data that satisfied the specified condition is returned by the method.
In order to use the described functionality, call the IEasyUAClientExtension2.WaitForMultipleValues method. There are multiple overloads.
It is not uncommon that an OPC server needs considerable time before it can provide the data requested. When you Read a node or Subscribe to a monitored item with some OPC servers, they will first deliver data with "bad" or "uncertain" severity in their status, and only after a while, data with "good" severity in their status are provided. This behavior, of course, creates a problem if all your code needs is that actual, "good" data value, for further processing. You cannot just do a Read; you need additional logic to overcome the possibility of these initial "uncertain" or "bad" results or updates.
QuickOPC has ready-made methods that contain the necessary logic. The IEasyUAClientExtension2.WaitForMultipleValues method is similar in its usage to ReadMultipleValues Method , and the IEasyUAClientExtension2.WaitForValue method is similar in its usage to ReadValue Method. Internally, however, they use subscriptions to possibly observe the data over a period of time, and automatically overcome the initial "unreliable" updates of the value.
The methods have various overloads that allow you to leave out some of the arguments and use their default values instead. In the full form, you need to specify: